# Contributor: Michał Polański <michal@polanski.me>
# Maintainer: Michał Polański <michal@polanski.me>
pkgname=sops
pkgver=3.7.3
pkgrel=1
pkgdesc="Simple and flexible tool for managing secrets"
url="https://github.com/mozilla/sops"
license="MPL-2.0"
arch="all"
makedepends="go"
source="https://github.com/mozilla/sops/archive/v$pkgver/sops-$pkgver.tar.gz
	skip-hcvault-tests.patch
	skip-pgp-tests.patch
	fix-tests.patch
	"
builddir="$srcdir/sops-$pkgver"
options="net" # for downloading Go modules

export GOPATH="$srcdir"
export GOFLAGS="$GOFLAGS -trimpath -modcacherw"
export CGO_ENABLED=0

build() {
	go build -v ./cmd/sops
}

check() {
	# remove -trimpath, tests fail otherwise
	GOFLAGS="${GOFLAGS/-trimpath}" go test ./...
}

package() {
	install -Dm755 sops "$pkgdir"/usr/bin/sops
}

sha512sums="
8210cb53eba4f71cbb1ea446f7dd32371e66eb02aef5df6458b0cef85adc44750e8c94f14769921dfbdaaa2cd75dbfa1ade01bf71c1e3ab2d7e7006f0b925758  sops-3.7.3.tar.gz
e1e718955e40e392a6faa12706107375a524e40636e684f096a51e115eca356b6c22f1922e9b758dae1b4978f36c89a6e6030ac680f79a65c4ac68218b4cdc84  skip-hcvault-tests.patch
9f1861a3e6c9fa5435a12d4052ef7c841fd58a15b75c3b4ab74e181185925970f69822c831252df1e2e44a673f88f220371d27392efd99c24e21e6cb5768778e  skip-pgp-tests.patch
3746f8db0342917324afe046a87677c44ac764b3162c18c9505f7f547e641fb04b4f28ebebeef2a78928bcd1df014c0d620e0ff57341355b300caa681d736927  fix-tests.patch
"
